package com.ruoyi.project.naming.namebook.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.project.naming.namebook.domain.NameBook;
import com.ruoyi.project.naming.namebook.mapper.NameBookMapper;
import com.ruoyi.project.naming.namebook.service.INameBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 起名书籍Service业务层处理
 *
 * @author shixiangwen
 * @date 2022-07-28
 */
@Service
@DataSource(DataSourceType.DICT)
public class NameBookServiceImpl implements INameBookService {
    @Autowired
    private NameBookMapper nameBookMapper;

    /**
     * 查询起名书籍
     *
     * @param id 起名书籍ID
     * @return 起名书籍
     */
    @Override
    public NameBook selectNameBookById(Long id) {
        return nameBookMapper.selectNameBookById(id);
    }

    /**
     * 查询起名书籍列表
     *
     * @param nameBook 起名书籍
     * @return 起名书籍
     */
    @Override
    public List<NameBook> selectNameBookList(NameBook nameBook) {
        return nameBookMapper.selectNameBookList(nameBook);
    }

    /**
     * 新增起名书籍
     *
     * @param nameBook 起名书籍
     * @return 结果
     */
    @Override
    public int insertNameBook(NameBook nameBook) {
        return nameBookMapper.insertNameBook(nameBook);
    }

    /**
     * 修改起名书籍
     *
     * @param nameBook 起名书籍
     * @return 结果
     */
    @Override
    public int updateNameBook(NameBook nameBook) {
        return nameBookMapper.updateNameBook(nameBook);
    }

    /**
     * 删除起名书籍对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteNameBookByIds(String ids) {
        return nameBookMapper.deleteNameBookByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除起名书籍信息
     *
     * @param id 起名书籍ID
     * @return 结果
     */
    @Override
    public int deleteNameBookById(Long id) {
        return nameBookMapper.deleteNameBookById(id);
    }
}
